//蜂鸣器播放

#include "Sing.h"

int tune[] = {
  A0,A0,A0,A3,A5,
  A6,A0,A0,A5,A6,A0,A0,A5,
  A6,AH1,A5,A6,A3,A0,A3,A5,
  A6,A0,A0,A5,A6,A0,A0,A5,
  A6,AH3,AH1,AH2,A6,A0,A3,A5,
  A6,A0,A0,A5,A6,A0,A0,A5,
  A6,AH1,A5,A6,A3,A5,A1,A2,
  A3,AH1,A6,AH3,
  AH2,AH3,AH2,AH1,AH2,A6,A0,
  A6,A6,A6,A6,AH1,AH2,AH3,
  A6,A6,A6,A5,A5,A6,
  A6,A6,A6,A6,AH1,AH2,AH3,
  A6,A6,A6,AH4,AH4,AH3,
  A6,A6,A6,A6,AH1,AH2,AH3,
  A6,A6,A6,A5,A5,A6,
  A6,A6,A6,A6,AH1,AH2,AH3,
  AH6,A5,A5,A6,A6
};

float duration[]= {
  1,1,1,0.5,0.5,
  0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,
  0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,
  0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,
  0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,
  0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,
  0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,
  1,1,1,1,
  0.5,0.25,0.25,0.5,0.5,1,1,
  1,1,1,0.25,0.25,0.25,0.25,
  1,1,0.5,0.5,0.5,0.5,
  1,1,1,0.25,0.25,0.25,0.25,
  1,1,0.5,0.5,0.5,0.5,
  1,1,1,0.25,0.25,0.25,0.25,
  1,1,0.5,0.5,0.5,0.5,
  1,1,1,0.25,0.25,0.25,0.25,
  1+0.5,0.5,0.5,0.5,1
};
int length;
const int FengMingPin = 2;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  length = sizeof(tune) / sizeof(tune[0]);
}

void loop() {
  // put your main code here, to run repeatedly:
  for (int x = 0; x < length; x++) {
    tone(FengMingPin, tune[x]);
    delay(450 * duration[x]);
    noTone(FengMingPin);
  }
  delay(5000);
}
